diff options
| author | joonhoekim <26rote@gmail.com> | 2025-10-30 21:21:29 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-10-30 21:21:29 +0900 |
| commit | 9d77688b3fbce108e170e0f874fbd9da66fd25d1 (patch) | |
| tree | ed6d8462c2c1ab3bbf932bb50309a1df308821f9 /app/api/auth/[...nextauth]/route.ts | |
| parent | 788eb678c45c6d3767cd2679c41ad5387ae6c3f0 (diff) | |
(김준회) 멀티도메인 대응 로그아웃 커스텀 처리, PO 생성 서버액션 연결
Diffstat (limited to 'app/api/auth/[...nextauth]/route.ts')
| -rw-r--r-- | app/api/auth/[...nextauth]/route.ts | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/app/api/auth/[...nextauth]/route.ts b/app/api/auth/[...nextauth]/route.ts index 58566cd6..d6ec807f 100644 --- a/app/api/auth/[...nextauth]/route.ts +++ b/app/api/auth/[...nextauth]/route.ts @@ -449,35 +449,12 @@ export const authOptions: NextAuthOptions = { }, async redirect({ url, baseUrl }) { - // 상대 경로인 경우 baseUrl과 결합 if (url.startsWith("/")) { return `${baseUrl}${url}`; } - - // 절대 URL인 경우: 허용된 도메인 목록 확인 - try { - const urlObj = new URL(url); - const allowedDomains = [ - "shidataroom.com", - "partners.sevcp.com", - "sevcp.com", - "localhost" // 개발 환경 - ]; - - // 허용된 도메인이면 그대로 반환 - if (allowedDomains.includes(urlObj.hostname)) { - return url; - } - - // 기존 로직: baseUrl과 origin이 같으면 허용 - if (urlObj.origin === baseUrl) { - return url; - } - } catch { - console.error('Invalid redirect URL:', url); + else if (new URL(url).origin === baseUrl) { + return url; } - - // 허용되지 않은 URL은 baseUrl로 리다이렉트 return baseUrl; }, }, |
